﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using IPTV.dao;
using IPTV.module;

/// <summary>
///ZtDetailService 的摘要说明
/// </summary>
public class ZtDetailService
{
	public ZtDetailService()
	{
		
	}

    public itv_zhzt_info getZtInfo(String id)
    {
        ZtDao ztDao = new ZtDao();
        List<itv_zhzt_info>  ztList = ztDao.getZtTemplateById(id);
        if (null != ztList && ztList.Count != 0)
        {
            return ztList[0];
        }
        else
        {
            return null;
        }
        
    }

    public List<itv_zhzt_list> getZtById(String id)
    {
        ZtDao ztDao = new ZtDao();
        return ztDao.getZtById(id);
    }


    public Dictionary<string, List<CourseDto>> getCoursesBySourceid(List<itv_zhzt_list> zhztList)
    {
        ZtDao ztDao = new ZtDao();
        Dictionary<string, List<CourseDto>> plateCourseMap = new Dictionary<string, List<CourseDto>>();
        foreach (itv_zhzt_list itv_zhzt_list in zhztList)
        {
            List<CourseDto> tmpList = ztDao.findCourseById(itv_zhzt_list.Sourceid);
            plateCourseMap.Add(itv_zhzt_list.Id.ToString(), tmpList);
        }
        return plateCourseMap;

    }
}